Release 10.1A: OpenEdge Development:
Progress 4GL Reference


CLASS statement

Defines a user-defined class, as well as the data members and methods that comprise the class.

Note: This statement is applicable only when used in a class definition (.cls) file.

Syntax

CLASS type-name [ INHERITS super-type-name ]
  [ IMPLEMENTS interface-type-name [, interface-type-name ] ... ]
  [ USE-WIDGET-POOL ]
  [ FINAL ]: 
  class-body 

type-name

A character string that specifies the type name of the class. Specify a class type name using the package.class-name syntax as described in the Type-name syntax reference entry in this book.

INHERITS super-type-name

An optional character string that specifies the type name of a super class whose state and behavioral characteristics the new class inherits. The new class becomes a subclass of this super class. Specify a super class type name using the package.class-name syntax as described in the Type-name syntax reference entry in this book.

The class definition (.cls) file for the super class must be found at compile time.

IMPLEMENTS interface-type-name [, interface-type-name ] ...

An optional character string that specifies the type name of one or more interfaces the new class implements. The new class must implement all methods defined in the specified interfaces. Specify an interface type name using the package.class-name syntax as described in the Type-name syntax reference entry in this book.

The class definition (.cls) file for the interface must be found at compile time.

For more information about defining an interface, see the INTERFACE statement reference entry in this book.

USE-WIDGET-POOL

Directs Progress to create an unnamed widget pool scoped to this class. When specified, all dynamic object instances are created in the unnamed widget-pool by default. Otherwise, object instances are created in the session unnamed widget-pool. Progress deletes the unnamed widget-pool when the object instance is deleted.

You can also define a named or unnamed widget-pool in a class definition file. If you define a named widget-pool, object instances are created in that widget-pool only if you explicitly reference the widget-pool name.

When you define an unnamed widget-pool in a method, it is scoped to that method. You can delete the widget-pool within the method by using the DELETE WIDGET-POOL statement, or let Progress delete the widget-pool when the method ends.

For more information about defining and using widget-pools within a class, see OpenEdge Getting Started: Object-oriented Programming .

FINAL

Indicates the class cannot be inherited by another class. That is, it cannot be used in the INHERITS phrase in another class definition. Define a class as FINAL when you do not want any of its state or behavior overridden.

class-body

The body of a class definition is composed of the following types of elements:

Example

The following example shows the definition of a class that inherits a super class and defines several data members:

CLASS acme.myObjs.CustObj INHERITS acme.myObjs.Common.CommonObj: 
  DEFINE PUBLIC VARIABLE m_NumCusts AS INTEGER NO-UNDO. 
  DEFINE PROTECTED TEMP-TABLE ttCust NO-UNDO
     FIELD CustNum LIKE Customer.CustNum
     FIELD Name LIKE Customer.Name. 
  DEFINE PRIVATE BUFFER cust FOR Customer. 
END CLASS. 

Notes

See also

CONSTRUCTOR statement, DEFINE PARAMETER statement, DEFINE VARIABLE statement, DESTRUCTOR statement, INTERFACE statement, METHOD statement, NEW statement


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095